package y23.Oct;

import java.util.Arrays;

public class Test1 {
    public static void main(String[] args) {
        int[] num = {5,11,7,2,3,17};
        sort(num,0, num.length);


    }

    public static void sort(int[] nums,int low,int high){
        if (low >= high) return;
        int i = low, j = high, t = 0;
        int tmp = nums[low];
        while (i < j) {
            while (i < j && nums[j] >= tmp) {
                j--;
            }
            while (i < j && nums[i] <= tmp) {
                i++;
            }
            if (i < j) {
                t = nums[i];
                nums[i] = nums[j];
                nums[j] = t;
            }
        }
        nums[low] = nums[i];
        nums[i] = tmp;
        sort(nums, low, i - 1);
        sort(nums, i + 1, high);
    }
}
